import {makeAutoObservable} from 'mobx'
import {http, setToken, clearToken, getToken} from '@/utils'
class LoginStore{
   token=getToken()||''
    constructor(){
         makeAutoObservable(this)
    }
    getToken=async({mobile,code})=>{
        const res = await http.post('/authorizations', {
            mobile,
            code
          })
          console.log(res)
          this.token=res.data.token
          setToken(res.data.token)
        console.log(setToken(res.data.token),'22222222')
          //setToken('a521018e-5f97-45ae-92b1-05244958d529')
    }
    loginOut=()=>{
        this.token=''
        clearToken()
    }

}

export {LoginStore}